// app/vendor/quotations/[id]/page.tsx - 견적 응답 페이지 import { Metadata } from "next" import { notFound } from "next/navigation" import db from "@/db/db"; import { eq } from "drizzle-orm" import { procurementVendorQuotations } from "@/db/schema" import { getServerSession } from "next-auth/next" import { authOptions } from "@/app/api/auth/[...nextauth]/route" import VendorQuotationEditor from "@/lib/procurement-rfqs/vendor-response/quotation-editor"; interface PageProps { params: Promise<{ id: string }> } export async function generateMetadata(props: PageProps): Promise { return { title: "견적서 응답", description: "RFQ에 대한 견적서 작성 및 제출", } } export default async function VendorQuotationPage(props: PageProps) { const params = await props.params const quotationId = parseInt(params.id) if (isNaN(quotationId)) { notFound() } // 인증 확인 const session = await getServerSession(authOptions); if (!session?.user) { return (

로그인이 필요합니다

견적서 응답을 위해 로그인해주세요.

) } // 견적서 정보 가져오기 const quotation = await db.query.procurementVendorQuotations.findFirst({ where: eq(procurementVendorQuotations.id, quotationId), with: { rfq: true, // 관계 설정 필요 vendor: true, // 관계 설정 필요 items: true, // 관계 설정 필요 } }) if (!quotation) { notFound() } // 벤더 권한 확인 (필요한 경우) const isAuthorized = session.user.domain === "partners" && session.user.companyId === quotation.vendorId if (!isAuthorized) { return (

접근 권한이 없습니다

이 견적서에 대한 권한이 없습니다.

) } return (
) }